# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/26 上午9:29
 @Author  : tgy
 
"""


def numEquivDominoPairs(dominoes: [[int]]) -> int:
    count = 0
    map = {}
    for k1, k2 in dominoes:
        ...
        key = (k1, k2)
        count += map.get(key, 0)
        if k1 != k2:
            count += map.get((k2, k1), 0)
        map[key] = (map.get(key, 0) + 1)

    return count


if __name__ == '__main__':
    ...
    res = numEquivDominoPairs([[1, 2], [2, 1], [2, 1], [1, 2], [3, 4], [5, 6]])
    print(res)
